﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlServerCe;

namespace CPTECH.Repository
{
    class BaseDB
    {
        protected SqlCeConnection conn;

        public void open()
        {
            if (conn == null || conn.State == ConnectionState.Closed)
            {
                //conn = new SqlCeConnection(@"Data Source=\dbInventario.sdf;");
                conn = new SqlCeConnection(@"Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\dbInventario.sdf;"));
                conn.Open();
            }
        }

        public void close()
        {
            if (conn != null && conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
    }
}
